package org.jetlinks.community.messaging.rabbitmq.command.admin;

import lombok.*;
import org.springframework.http.HttpMethod;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateUser extends AdminCommand<Mono<Void>> {

    private String username;

    private String password;

    @Builder.Default
    private String tags = "";

    @Override
    public String api() {
        return "/api/users/" + username;
    }

    @Override
    public HttpMethod method() {
        return HttpMethod.PUT;
    }

    @Override
    public Mono<Void> convert(WebClient.ResponseSpec responseSpec) {
        return responseSpec
            .bodyToMono(Void.class);
    }
}
